<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('任务成果提交')" />
</head>
<body class="gray-bg">
	<div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="post-form">
					<div class="select-list">
						<ul>
							<li>
								任务标题：<input type="text" name="task_title"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
							    <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="management:achievement:edit">
					<i class="fa fa-edit"></i> 成果提交
				</a>
			</div>
	        <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script th:inline="javascript">
		var editFlag = [[${@permission.hasPermi('system:post:edit')}]];
		var removeFlag = [[${@permission.hasPermi('system:post:remove')}]];
		var datas = [[${@dict.getType('sys_normal_disable')}]];
		var prefix = ctx + "management/achievement";

		$(function() {
		    var options = {
		        url: prefix + "/list",
		        // createUrl: prefix + "/add",
		        updateUrl: prefix + "/edit/{id}",
		        // removeUrl: prefix + "/remove",
		        sortName: "task_id",
		        modalName: "任务",
		        columns: [{
		            checkbox: true
		        },
				{
					field: 'task_id',
					title: '任务Id',
					sortable: true
				},
		        {
		            field: 'task_title',
		            title: '任务标题',
		        },
		        {
		            field: 'userName',
		            title: '执行人员',

		        },
		        {
		            field: 'starttime',
		            title: '开始时间',
		        },
				{
					field: 'endtime',
					title: '截止时间',
				},
				{
					field: 'status',
					title: '状态',
					formatter: function(value, row, index) {
						return statusRules(value);
					}
				},
				{
					field: 'priority',
					title: '紧急程度',
					formatter: function(value, row, index) {
						return priorityRules(value);
					}
				},
				{
					title: '操作',
					align: 'center',
					formatter: function(value, row, index) {
						var actions = [];
						actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.task_id + '\')"><i class="fa fa-edit"></i>查看</a> ');
						return actions.join('');
					}
				}]
		    };
		    $.table.init(options);
		});

		function statusRules(value) {
			if (value == 1) {
				return '<p class="badge badge-primary">已完成</p>';
			} else if (value == 2) {
				return '<p class="badge badge-danger">未完成</p>';
			} else {
				return '<p class="badge badge-default">已放弃</p>';
			}
		}
		
		function priorityRules(value) {
			if (value == 0) {
				return '<p class="badge badge-primary">普通</p>';
			} else if (value == 1) {
				return '<p class="badge badge-warning">紧急</p>';
			} else {
				return '<p class="badge badge-danger">非常紧急</p>';
			}
		}
	</script>
</body>
</html>